package jgl.vajra.operator.part.vehicle.activity;

import androidx.recyclerview.widget.LinearLayoutManager;

import java.util.ArrayList;
import java.util.List;

import jgl.vajra.operator.R;
import jgl.vajra.operator.databinding.ActivityCommonAddressBinding;
import jgl.vajra.operator.manager.IntentManager;
import jgl.vajra.operator.part.vehicle.contract.CommonAddressContract;
import jgl.vajra.operator.part.vehicle.viewModel.CommonAddressViewModel;
import jgl.vajra.operator.widget.databindingadapter.SingleTypeBindingAdapter;
import jgl.vajra.operator.widget.mvvm.factory.CreateViewModel;
import jgl.vajra.operator.widget.mvvm.view.BaseMVVMActivity;

@CreateViewModel(CommonAddressViewModel.class)
public class CommonAddressActivity extends BaseMVVMActivity<CommonAddressViewModel, ActivityCommonAddressBinding> implements CommonAddressContract.View {
    @Override
    public int getLayoutId() {
        return R.layout.activity_common_address;
    }

    @Override
    public void initView() {
        super.initView();
        mBinding.setView(this);

        List<String> list=new ArrayList<>();
        list.add("");
        list.add("");

        //设置布局管理器
        mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
        SingleTypeBindingAdapter<Object> adapter = new SingleTypeBindingAdapter<>(this, list, R.layout.item_common_address);
        mBinding.recyclerView.setAdapter(adapter);
//        adapter.setItemPresenter(this);
    }

    //添加常用地址
    @Override
    public void onAddCommonAddress() {
        IntentManager.toEditAddressActivity(this);
    }
}
